package com.java3_13;

import javax.swing.text.html.HTMLDocument;
import java.sql.Array;
import java.util.*;

public class java3_13 {
    //    public static void main(String[] args) {
//        //Map
//        //HashMap - LinkedHashMap - TreeMap - Hashtable - properties
////        HashMap hashMap = new HashMap();
////        hashMap.put("zhangsan",20);
////        hashMap.put("lisi",22);
////        hashMap.put("wangwu",25);
////        hashMap.put("zhaoliu",28);
////        System.out.println(hashMap);
//        //key - Set
//        //value - Collection
//        //Entry - Set
//
//        //每个元素之间有双向链表连接
////        LinkedHashMap linkedHashMap = new LinkedHashMap();
////        linkedHashMap.put("zhangsan",20);
////        linkedHashMap.put("lisi",22);
////        linkedHashMap.put("wangwu",21);
////        linkedHashMap.put("zhaolliu",27);
////        System.out.println(linkedHashMap);
//
//        //TreeMap - 能按照属性的大小进行输出
////        TreeMap treeMap = new TreeMap();
////        treeMap.put("zhangsan",20);
////        treeMap.put("lisi",22);
////        treeMap.put("wangwu",23);
////        treeMap.put("zhaoliu",20);
////        System.out.println(treeMap);
//        //默认使用key的属性大小进行比较
//
////        TreeMap treeMap = new TreeMap();
////        treeMap.put(2,"zhangsan");
////        treeMap.put(1,"lisi");
////        treeMap.put(4,"wangwu");
////        treeMap.put(3,"zhaoliu");
////        System.out.println(treeMap);
//        //自动按照key的属性大小进行排序
//
//        //Map中的常用方法
////        TreeMap treeMap = new TreeMap();
////        treeMap.put(2,"zhangsan");
////        treeMap.put(1,"lisi");
////        treeMap.put(4,"wangwu");
////        treeMap.put(3,"zhaoliu");
////        TreeMap treeMap1 = new TreeMap();
////        System.out.println(treeMap1);
////        //putAll()方法
////        treeMap1.putAll(treeMap);
////        System.out.println(treeMap1);
////        treeMap1.clear();
////        //clear()
////        System.out.println(treeMap1);
//
////        TreeMap treeMap = new TreeMap();
////        treeMap.put(2,"zhangsan");
////        treeMap.put(1,"lisi");
////        treeMap.put(4,"wangwu");
////        treeMap.put(3,"zhaoliu");
////        System.out.println(treeMap);
////        treeMap.remove(3);
////        treeMap.remove(1);
////        System.out.println(treeMap);
////        //get使用key -> value
////        Object o = treeMap.get(2);
////        System.out.println(o);
//
////        TreeMap treeMap = new TreeMap();
////        treeMap.put(2,"zhangsan");
////        treeMap.put(1,"lisi");
////        treeMap.put(4,"wangwu");
////        treeMap.put(3,"zhaoliu");
////        //是否包含key
////        boolean b = treeMap.containsKey(2);
////        System.out.println(b);
////        System.out.println(treeMap.containsValue("coco"));
//
////        TreeMap treeMap = new TreeMap();
////        treeMap.put(2,"zhangsan");
////        treeMap.put(1,"lisi");
////        treeMap.put(4,"wangwu");
////        treeMap.put(3,"zhaoliu");
//
////        ArrayList list = new ArrayList();
////        list.add(123);
////        list.add("hello world");
////        list.add('A');
////        list.add(3.14);
////        Iterator iterator = list.iterator();
////        while(iterator.hasNext()){
////            System.out.println(iterator.next());
////        }
//
//        //由于Tree对内部的数据进行了排序所以数据类型必须相同
////        TreeSet treeSet = new TreeSet();
////        treeSet.add(123);
////        treeSet.add(345);
////        treeSet.add(12);
////        treeSet.add(3);
////        Iterator iterator = treeSet.iterator();
////        while(iterator.hasNext()){
////            System.out.println(iterator.next());
////        }
//
//        //Map中的三种遍历
////        TreeMap treeMap = new TreeMap();
////        treeMap.put(2,"zhangsan");
////        treeMap.put(1,"lisi");
////        treeMap.put(4,"wangwu");
////        treeMap.put(3,"zhaoliu");
////        返回一个Set类型的集合
////        Set set = treeMap.keySet();
////        Iterator iterator = set.iterator();
////        while(iterator.hasNext()){
////            System.out.println(iterator.next());
////        }
//
//        //value
////        TreeMap treeMap = new TreeMap();
////        treeMap.put(2,"zhangsan");
////        treeMap.put(1,"lisi");
////        treeMap.put(4,"wangwu");
////        treeMap.put(3,"zhaoliu");
////        for (Object value : treeMap.values()) {
////            System.out.println(value);
////        }
//
//
//        //Entry
////        TreeMap treeMap = new TreeMap();
////        treeMap.put(2, "zhangsan");
////        treeMap.put(1, "lisi");
////        treeMap.put(4, "wangwu");
////        treeMap.put(3, "zhaoliu");
////        Set set = treeMap.entrySet();
////        Iterator iterator = set.iterator();
////        while (iterator.hasNext()) {
////            Object next = iterator.next();
////            //作用就是拿出其中的对象
////            Map.Entry next1 = (Map.Entry) next;
////            System.out.println(next1.getKey() + "-------->" + next1.getValue());
////        }
//
//
////        int a = 10;
////        int b = 20;
////        System.out.println(MyMath.add(a,b));
//
//        //Collections工具类
//
////        ArrayList list = new ArrayList();
////        list.add(123);
////        list.add("hello world");
////        list.add(3.14);
////        System.out.println(list);
////        Collections.reverse(list);
////        System.out.println(list);
////
////        //shuffle
////        Collections.shuffle(list);
////        System.out.println(list);
//
////        ArrayList list = new ArrayList();
////        list.add("zhangsan");
////        list.add("lisi");
////        list.add("wangwu");
////        list.add("zhaoliu");
////        System.out.println(list);
//
//        //排序
////        Collections.sort(list, new Comparator() {
////            @Override
////            public int compare(Object o1, Object o2) {
////                String o11 = (String) o1;
////                String o22 = (String) o2;
////                return -(o11.compareTo(o22));
////            }
////        });
////        System.out.println(list);
//
//
////        ArrayList list = new ArrayList();
////        list.add("zhangsan");
////        list.add("lisi");
////        list.add("wangwu");
////        list.add("wangwu");
////        list.add("wangwu");
////        list.add("zhaoliu");
////        System.out.println(list);
//
//        //交换
////        Collections.swap(list,1,2);
////        System.out.println(list);
//
//
////        int frequency = Collections.frequency(list,"wangwu");
////        System.out.println(frequency);
//
//
//
//        //max和min底层都是用了比较器
////        Comparable max = Collections.max(list,new Comparator<String>(){
////            @Override
////            public int compare(String o1, String o2) {
////                return (-o1.compareTo(o2));
////            }
////        });
////        System.out.println(max);
//
//
//    }
//    public static void main(String[] args) {
////        List<Integer> list = Arrays.asList(12, 23, 34, 45, 56, 67, 78, 89, 90);
////        //创建一个集合长度的数组然后变成集合
////        List<Object> list1 = Arrays.asList(new Object[list.size()]);
////        Collections.copy(list1,list);
////        System.out.println(list1);
//
//
////        ArrayList list = new ArrayList();
////        list.add("zhangsan");
////        list.add("lisi");
////        list.add("lisi");
////        list.add("lisi");
////        list.add("wangwu");
////        list.add("zhaoliu");
////        System.out.println(list);
////
////        Collections.replaceAll(list,"lisi","coco");
////        System.out.println(list);
////
////        ArrayList list = new ArrayList();
////        list.add(123);
////        list.add("hello world");
////        list.add('a');
////        list.add(3.14);
//
//        //全部抛出异常
////        List list1 = Collections.unmodifiableList(list);
////
////
////        list1.clear();
////        System.out.println(list1);
//
////        ArrayList list = new ArrayList();
////        list.add(123);
////        list.add("hello world");
////        list.add('a');
////        list.add(3.14);
////
////        //全部使用synchronized包裹
////        List list1 = Collections.synchronizedList(list);
//
//
//
//
//
//    }
//    public static void main(String[] args) {
//        MyEnum summer = MyEnum.SUMMER;
//        System.out.println(summer.toString());
//
//
//
//    }
//    public static void main(String[] args) {
//        //泛型在集合中的使用
//
////        ArrayList<String> list = new ArrayList<>();
////        list.add("zhangsan");
////        list.add("hello world");
////        list.add("java");
////
////        Iterator<String> iterator = list.iterator();
////        while(iterator.hasNext()){
////            System.out.println(iterator.next());
////        }
//
//
////        list.add(123);
//
//
////        HashMap<String,Integer> map = new HashMap<>();
////        map.put("zhangsan",20);
////        map.put("lisi",22);
////        map.put("wangwu",25);
//////        map.put(123,'Z');
////
//
////
////        HashMap<String,Integer> map = new HashMap<>();
////        map.put("zhangsan",20);
////        map.put("lisi",22);
////        map.put("wangwu",25);
////
////
//////        Set<Map.Entry<String, Integer>> set = map.entrySet();
//////        Iterator<Map.Entry<String,Integer>> iterator =  set.iterator();
////          var set = map.entrySet();
////          var iterator = set.iterator();
//
//
//
////        var map = new HashMap<>();
////        map.put("zhangsan",20);
////        map.put("lisi",22);
////        map.put("wangwu",25);
//
////        var str = "hello world";
//
//
//
//
//
//    }
    public static void main(String[] args) {


//        List<String> list = null;
//        ArrayList<String> list1 = new ArrayList<>();
//        list = list1;



//        ArrayList<String> list = new ArrayList<>();
//        ArrayList<?> list2 = null;
//        list.add("hello world");
//        list.add("java");
//        list2 = list;
//        for (Object obj : list2){
//            System.out.println(obj);
//        }


        ArrayList<? super Father> list = null;
        ArrayList<Father> Father = new ArrayList<>();
        ArrayList<Son> Son = new ArrayList<>();
        ArrayList<Object> object = new ArrayList<>();

        list.add(new Father());
        list.add(new Son());




    }




}
